package com.de.juxfux.io;

import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;

import com.de.juxfux.Const;


public class JuxStats {
	public static final String TAG = JuxStats.class.getSimpleName();
	public String name = "";
	public int datasetCount = 0;
	public int taggedDatasetCount = 0;
	public int tagsCount = 0;
	public int wordsCount = 0;
	public Set<String> distIds = new TreeSet<String>();
	public Set<String> distTypes = new TreeSet<String>();
	public Set<String> distinctTags = new TreeSet<String>();
	public Set<String> distCategories = new TreeSet<String>();
	public Set<String> distinctWords = new TreeSet<String>();
	

	public String generateHtmlReport() {
		TreeMap<String, Integer> statsMap = generateStatsMap();
		String report = "";
		for (Entry<String, Integer> entry : statsMap.entrySet()) {
			report += "<b>"+entry.getKey()+":  </b><i>"+entry.getValue()+"</i><br>";
		}
		return report;
	}
	
	private TreeMap<String, Integer> generateStatsMap() {
		TreeMap<String, Integer> countMap = new TreeMap<String, Integer>();
		countMap.put(Const.DATASETS, datasetCount);
		countMap.put(Const.TAGGED_DATASETS, taggedDatasetCount);
		countMap.put(Const.IDS, distIds.size());
		countMap.put(Const.TYPES, distTypes.size());
		countMap.put(Const.CATEGORIES, distCategories.size());
		countMap.put(Const.DISTINCT_TAGS, distinctTags.size());
		countMap.put(Const.TOTAL_TAGS, tagsCount);
		countMap.put(Const.DISTINCT_WORDS, distinctWords.size());
		countMap.put(Const.TOTAL_WORDS, wordsCount);
		return countMap;
	}
	
	
}
